package jeesample.model;

import com.google.gson.Gson;
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

@DatabaseTable(tableName = "Room")
public class Room {

	public static final String HASHCODE = "HashCode";
	public static final String ROOMID = "RoomId";
	public static final String NAME = "Name";
	public static final String LOCATION = "Location";
	public static final String COMMENTS = "Comments";

	@DatabaseField(generatedId = true)
	private int id;

	@DatabaseField(persisted = false)
	private String hashCode;

	@DatabaseField(columnName = ROOMID, canBeNull = false)
	private String roomId;

	@DatabaseField(columnName = NAME, canBeNull = false)
	private String name;

	@DatabaseField(columnName = LOCATION, canBeNull = false, index = true)
	private String location;

	@DatabaseField(columnName = COMMENTS, canBeNull = true)
	private String comments;

	// all persisted classes must define a no-arg constructor with at least
	// package visibility
	public Room() {
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getLocation() {
		return location;
	}

	public void setLocation(String location) {
		this.location = location;
	}

	public String getRoomId() {
		return roomId;
	}

	public void setRoomId(String roomId) {
		this.roomId = roomId;
	}

	public String getHashCode() {
		return hashCode;
	}

	public void setHashCode(String hashCode) {
		this.hashCode = hashCode;
	}

	public String getComments() {
		return comments;
	}

	public void setComments(String comments) {
		this.comments = comments;
	}

	public String toString() {
		Gson gson = new Gson();
		return gson.toJson(this);
	}

}
